package com.xiaojiehzu.jex.client.config;

import java.util.Arrays;
import java.util.List;

/**
 * @author 朱小杰
 * 时间 2017-11-05 .13:26
 * 说明 ...
 */
public class JexConfiguration {
    /**
     * 当前应用名称
     */
    private String appName;

    /**
     * jex-server的地址
     */
    private List<String> serverAddress;


    public String getAppName() {
        return appName;
    }

    public void setAppName(String appName) {
        this.appName = appName;
    }

    public List<String> getServerAddress() {
        return serverAddress;
    }

    public void setServerAddress(List<String> serverAddress) {
        this.serverAddress = serverAddress;
    }

    public static JexConfiguration buildJexConfiguration(String[] serverAddress, String appName) {
        JexConfiguration jexConfiguration = new JexConfiguration();
        jexConfiguration.setAppName(appName);
        jexConfiguration.setServerAddress(Arrays.asList(serverAddress));
        return jexConfiguration;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("JexConfiguration{");
        sb.append("appName='").append(appName).append('\'');
        sb.append(", serverAddress=").append(serverAddress);
        sb.append('}');
        return sb.toString();
    }
}
